'use strict';
var path=require('path'),
    node_modules_dir=path.resolve(__dirname,'node_modules'),
    deps=[
    'react/dist/react.min.js',
    'react-dom/dist/react-dom.min.js'
];
var config={
    entry:'./app/app.js',
    output:{
        path:'./app/build',
        publicPath:'./app/build/',
        filename:'bundle.js'
    },
    module:{
        noParse:[],
        loaders:[
            {
                test:/\.jsx?$/,
                loader:'react-hot!babel?presets[]=react,presets[]=es2015',
                exclude:/node_modules/
            },
            {
                test:/\.css$/,
                loader:'style-loader!css-loader'
            },
            {
                test:/\.(png|jpg)$/,
                loader:"url?limit=2500"
            },
            {
                test:/\.woff$/,
                loader:'url?limit=100000'
            }
        ]
    },
    resolve:{
        //重定向文件路径(解析优化)
        alias:{}
        //
    }
};
deps.forEach(function (dep) {
    var depPath = path.resolve(node_modules_dir, dep);
    console.log(dep);
    config.resolve.alias[dep.split(path.sep)[0]] = depPath;
    config.module.noParse.push(depPath);
});
config.resolve.alias.zhangxin="zhangxin";
console.log(config.resolve.alias);
module.exports=config;
//npm install babel-loader  babel-preset-es2015 babel-preset-react --save-dev